<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCarsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cars', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('user_id')->comment('车主id');
            $table->string('plate_type', 32)->comment('车辆类型');
            $table->string('number', 32)->comment('车牌号码');
            $table->string('driving_license', 128)->comment('行驶证');
            $table->string('car_type', 32)->comment('车型');
            $table->unsignedInteger('car_length')->comment('车长');
            $table->unsignedInteger('weight')->comment('载重');
            $table->string('carriage_num', 32)->comment('车厢号码');
            $table->unsignedInteger('volume')->comment('车厢体积');
            $table->unsignedInteger('carrage_length')->comment('车厢长度');
            $table->string('register_date', 11)->comment('车辆注册日期');
            $table->string('car_brand')->nullable()->comment('车辆品牌型号');
            $table->string('identification_code')->comment('车辆识别码');
            $table->string('engine', 64)->nullable()->comment('发动机');
            $table->string('engine_num', 128)->comment('发动机号');
            $table->string('axle', 32)->comment('拖挂轴数');
            $table->string('owner', 32)->comment('所属人');
            $table->tinyInteger('is_allow')->default(0)->comment('是否允许派发他人使用：0为不允许，1为允许');
            $table->unsignedTinyInteger('status')->default(0)->comment('审核状态：0为待审核、1为审核通过');
            $table->charset = 'utf8';
            $table->collation = 'utf8_unicode_ci';
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('cars');
    }
}
